import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '设备id',
    align: 'center',
    dataIndex: 'deviceId',
  },
  {
    title: '用户id',
    align: 'center',
    dataIndex: 'userId',
  },
  {
    title: '用户名',
    align: 'center',
    dataIndex: 'userName',
  },
  {
    title: '作者名',
    align: 'center',
    dataIndex: 'author',
  },
  {
    title: '联系邮箱',
    align: 'center',
    dataIndex: 'email',
  },
  {
    title: '作品名称',
    align: 'center',
    dataIndex: 'bookName',
  },
  {
    title: '作品类型',
    align: 'center',
    dataIndex: 'catId',
  },
  {
    title: '作品简介',
    align: 'center',
    dataIndex: 'bookDesc',
  },
  {
    title: '预计字数',
    align: 'center',
    dataIndex: 'wordCount',
  },
  {
    title: '书籍状态',
    align: 'center',
    dataIndex: 'bookStatus',
  },
  {
    title: '是否愿意接受编辑指导',
    align: 'center',
    dataIndex: 'acceptGuidance',
  },
  {
    title: '独家/非独家签约',
    align: 'center',
    dataIndex: 'exclusive',
  },
  {
    title: '期待收入',
    align: 'center',
    dataIndex: 'expectIncome',
  },
  {
    title: '国家',
    align: 'center',
    dataIndex: 'country',
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '用户id',
    field: 'userId',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '用户名',
    field: 'userName',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '设备id',
    field: 'deviceId',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label:
      '申请状态：上一次申请已经结束：write_project 已经提交过write project：signing_intention 填写完成signing_intention：applied 申请状态为审阅中：reviewing 申请状态为待沟通：contact 申请状态为拒绝：deny 申请状态为签约：sign',
    field: 'signStatus',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '邮箱',
    field: 'email',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '作者名',
    field: 'author',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '作品名称',
    field: 'bookName',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '国家',
    field: 'country',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '签约时间',
    field: 'signTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
    },
    colProps: { span: 6 },
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '用户id',
    field: 'userId',
    component: 'InputNumber',
  },
  {
    label: '用户名',
    field: 'userName',
    component: 'Input',
  },
  {
    label: '设备id',
    field: 'deviceId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入设备id!' }];
    },
  },
  {
    label:
      '申请状态：上一次申请已经结束：write_project 已经提交过write project：signing_intention 填写完成signing_intention：applied 申请状态为审阅中：reviewing 申请状态为待沟通：contact 申请状态为拒绝：deny 申请状态为签约：sign',
    field: 'signStatus',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        {
          required: true,
          message:
            '请输入申请状态：上一次申请已经结束：write_project 已经提交过write project：signing_intention 填写完成signing_intention：applied 申请状态为审阅中：reviewing 申请状态为待沟通：contact 申请状态为拒绝：deny 申请状态为签约：sign!',
        },
      ];
    },
  },
  {
    label: '邮箱',
    field: 'email',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入邮箱!' }];
    },
  },
  {
    label: '作者名',
    field: 'author',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入作者名!' }];
    },
  },
  {
    label: '作品名称',
    field: 'bookName',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入作品名称!' }];
    },
  },
  {
    label: '作品类型',
    field: 'catId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入作品类型!' }];
    },
  },
  {
    label: '作品简介',
    field: 'bookDesc',
    component: 'InputTextArea',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入作品简介!' }];
    },
  },
  {
    label: '作品文档',
    field: 'bookDocUrl',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入作品文档!' }];
    },
  },
  {
    label: '0：50K-100K words、1：100K-150K words、2：150K-200K words、3：200K-250K words、4：>250K words',
    field: 'wordCount',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入0：50K-100K words、1：100K-150K words、2：150K-200K words、3：200K-250K words、4：>250K words!' }];
    },
  },
  {
    label: '书籍状态，0：Ongoing，1：Completed',
    field: 'bookStatus',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入书籍状态，0：Ongoing，1：Completed!' }];
    },
  },
  {
    label: '是否愿意接受编辑指导：1:Yes、0:No',
    field: 'acceptGuidance',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入是否愿意接受编辑指导：1:Yes、0:No!' }];
    },
  },
  {
    label: '独家/非独家签约，0:否，1:是',
    field: 'exclusive',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入独家/非独家签约，0:否，1:是!' }];
    },
  },
  {
    label: '期待收入0:$0-$10、1:$10-$20、2:$20-$50、3$50-$100、4:>$100',
    field: 'expectIncome',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入期待收入0:$0-$10、1:$10-$20、2:$20-$50、3$50-$100、4:>$100!' }];
    },
  },
  {
    label: '国家',
    field: 'country',
    component: 'Input',
  },
  {
    label: '签约时间',
    field: 'signTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
